package com.chunguang.netty.listener;

import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;

import com.chunguang.netty.comon.Client;
import com.chunguang.netty.domain.RequestData;
import com.chunguang.netty.domain.TransferData;
import com.chunguang.netty.service.RequestDataService;

import io.netty.channel.ChannelFuture;

public class TestMain {

	public static void main(String[] args) {
		Client c = Client.getInstance();
		ChannelFuture cf = c.getChannelFuture();
		
		ApplicationContext context = ApplicationFactory.getContext();
		System.out.println("dddddddd");
		RequestDataService service = (RequestDataService) context.getBean("requestDataService");
		TransferData transferData = new TransferData();
		transferData.setCheckNumber("aaaaaaaaaaaaaaaaaa");
		service.insert(transferData );
		RequestData requestData2 = new RequestData();
		BeanUtils.copyProperties(transferData, requestData2, new String[]{"sync"});
		cf.channel().writeAndFlush(requestData2);
	}
}
